home *** CD-ROM | disk | FTP | other *** search
/ Chip: Internet / Chip Internet.iso / viewer / ghost / gsview.h < prev    next >
C/C++ Source or Header  |  1993-08-05  |  15KB  |  473 lines

  1. /*
  2.  * gsview.h -- Include file for GSVIEW.EXE 
  3.  * Copyright (C) 1993  Russell Lang
  4.  *
  5.  * This program is free software; you can redistribute it and/or modify
  6.  * it under the terms of the GNU General Public License as published by
  7.  * the Free Software Foundation; either version 2 of the License, or
  8.  * (at your option) any later version.
  9.  *
  10.  * This program is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  * GNU General Public License for more details.
  14.  *
  15.  * You should have received a copy of the GNU General Public License
  16.  * along with this program; if not, write to the Free Software
  17.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  *
  19.  *   Author: Russell Lang
  20.  * Internet: rjl@monu1.cc.monash.edu.au
  21.  */
  22.  
  23. #define GSVIEW_VERSION "1.0  1993-08-05"
  24.  
  25. #define ID_ANSWER    51
  26. #define ID_PROMPT    52
  27. #define ID_HELP        53
  28.  
  29. #define IDM_OPEN    101
  30. #define IDM_CLOSE    102
  31. #define IDM_NEXT    103
  32. #define IDM_NEXTSKIP    104
  33. #define IDM_REDISPLAY   105
  34. #define IDM_PREV    106
  35. #define IDM_PREVSKIP    107
  36. #define IDM_GOTO    108
  37. #define IDM_INFO    109
  38. #define IDM_SELECT    110
  39. #define IDM_PRINT    111
  40. #define IDM_PRINTTOFILE 112
  41. #define IDM_SPOOL    113
  42. #define IDM_EXTRACT    114
  43. #define IDM_PSTOEPS    115
  44. #define IDM_EXIT    116
  45. #define IDM_DROP    117
  46. #define IDM_SKIP    118
  47.  
  48. #define IDM_COPYCLIP    151
  49. #define IDM_PASTETO    152
  50. #define IDM_CONVERT    153
  51. #define IDM_MAKEEPSI    154
  52. #define IDM_MAKEEPST4    155
  53. #define IDM_MAKEEPST    156
  54. #define IDM_MAKEEPSW    157
  55. #define IDM_EXTRACTPS    158
  56. #define IDM_EXTRACTPRE    159
  57.  
  58. #define IDM_GSCOMMAND      175
  59. #define IDM_SOUNDS      176
  60. #define IDM_SETTINGS      177
  61. #define IDM_SAVESETTINGS  178
  62. #define IDM_SAFER         179  
  63. #define IDM_SAVEDIR      180
  64. #define IDM_BUTTONSHOW      181
  65. #define IDM_QUICK      182
  66. #define IDM_AUTOREDISPLAY 183
  67. #define IDM_EPSFCLIP      184
  68. #define IDM_EPSFWARN      185
  69.  
  70. #define IDM_PORTRAIT    201
  71. #define IDM_LANDSCAPE   202
  72. #define IDM_UPSIDEDOWN  203
  73. #define IDM_SEASCAPE    204
  74. #define IDM_SWAPLANDSCAPE 205
  75.  
  76. #define IDM_RESOLUTION  251
  77.  
  78. #define IDM_LETTER    301
  79. #define IDM_LETTERSMALL    302
  80. #define IDM_TABLOID    303
  81. #define IDM_LEDGER    304
  82. #define IDM_LEGAL    305
  83. #define IDM_STATEMENT    306
  84. #define IDM_EXECUTIVE    307
  85. #define IDM_A3        308
  86. #define IDM_A4        309
  87. #define IDM_A4SMALL    310
  88. #define IDM_A5        311
  89. #define IDM_B4        312
  90. #define IDM_B5        313
  91. #define IDM_FOLIO    314
  92. #define IDM_QUARTO    315
  93. #define IDM_10X14    316
  94. #define IDM_USERSIZE    317
  95. #define IDM_MEDIALAST    318
  96.  
  97. #define IDM_HELPCONTENT 351
  98. #define IDM_HELPSEARCH    352
  99. #define IDM_ABOUT    353
  100.  
  101. #define INFO_FILE    401
  102. #define INFO_TYPE    402
  103. #define INFO_TITLE    403
  104. #define INFO_DATE    404
  105. #define INFO_BBOX    405
  106. #define INFO_ORIENT    406
  107. #define INFO_ORDER    407
  108. #define INFO_DEFMEDIA    408
  109. #define INFO_NUMPAGES    409
  110. #define INFO_PAGE    410
  111. #define INFO_BITMAP    411
  112. #define INFO_ICON    412
  113.  
  114. #define ABOUT_ICON    451
  115. #define ABOUT_VERSION    452
  116.  
  117. #define SOUND_EVENT    501
  118. #define SOUND_FILE    502
  119. #define SOUND_PATH    503
  120. #define SOUND_TEST    504
  121.  
  122. #define SPOOL_PORT    525
  123.  
  124. #define CANCEL_PCDONE    541
  125.  
  126. #define PAGE_LIST    551
  127. #define PAGE_ALL    552
  128. #define PAGE_ODD    553
  129. #define PAGE_EVEN    554
  130.  
  131. #define DEVICE_NAME    561
  132. #define DEVICE_RES    562
  133. #define DEVICE_RESTEXT    563
  134. #define DEVICE_PROP    564
  135.  
  136. #define PROP_NAME    571
  137. #define PROP_VALUE    572
  138.  
  139. #define EPS_INTERCHANGE    581
  140. #define EPS_WINDOWS    582
  141. #define EPS_TIFF    583
  142.  
  143. #define BB_PROMPT    591
  144. #define BB_CLICK    592
  145.  
  146. #define FILTER_PS    1
  147. #define FILTER_EPS    2
  148. #define FILTER_EPI    3
  149. #define FILTER_ALL    4
  150. #define FILTER_BMP    5
  151. #define FILTER_TIFF    6
  152. #define FILTER_WMF    7
  153. #define IDS_FILTER    601
  154. #define IDS_TITLE    602
  155. #define IDS_HELPFILE    603
  156. #define IDS_WRONGGS    604
  157. #define IDS_BUSY    605
  158.  
  159. #define IDS_FILE    610
  160. #define IDS_NOFILE    611
  161. #define IDS_PAGE    612
  162. #define IDS_NOPAGE    613
  163. #define IDS_LANDSCAPE    614
  164. #define IDS_PORTRAIT    615
  165. #define IDS_ASCEND    616
  166. #define IDS_DESCEND    617
  167. #define IDS_SPECIAL    618
  168. #define IDS_EPSF    619
  169. #define IDS_EPSI    620
  170. #define IDS_EPST    621
  171. #define IDS_EPSW    622
  172. #define IDS_DSC        623
  173. #define IDS_NOTDSC    624
  174. #define IDS_PAGEINFO    625
  175.  
  176. #define IDS_OUTPUTFILE    630
  177. #define IDS_PRINTINGALL    631
  178. #define IDS_PRINTFILE    632
  179. #define IDS_NOSPOOL    633
  180. #define IDS_SELECTPAGE    634
  181. #define IDS_SELECTPAGES    635
  182. #define IDS_TIMEOUT    636
  183. #define IDS_NOTIMER    637
  184. #define IDS_NOTOPEN    638
  185. #define IDS_CANNOTRUN    639
  186. #define IDS_TOOLONG    640
  187. #define IDS_WAIT    641
  188. #define IDS_NOMORE    642
  189. #define IDS_GSCOMMAND    643
  190. #define IDS_RES        644
  191. #define    IDS_USERWIDTH    645
  192. #define    IDS_USERHEIGHT    646
  193. #define IDS_BADEPS    647
  194. #define IDS_NOPREVIEW    648
  195. #define IDS_NOTDFNAME   649
  196. #define IDS_PIPEERR    650
  197. #define IDS_CANCELDONE    651
  198. #define IDS_BADCLI      652
  199.  
  200. #define IDS_SOUNDNAME    670
  201. #define IDS_SNDPAGE    671
  202. #define IDS_SNDNOPAGE    672
  203. #define IDS_SNDNONUMBER 673
  204. #define IDS_SNDNOTOPEN    674
  205. #define IDS_SNDERROR    675
  206. #define IDS_SNDTIMEOUT    676
  207. #define IDS_SNDSTART    677
  208. #define IDS_SNDEXIT    678
  209. #define IDS_SOUNDNOMM    679
  210. #define IDS_NONE    680
  211. #define IDS_SPKR    681
  212.  
  213. /* help topics */
  214. #define IDS_TOPICROOT    701
  215. #define IDS_TOPICOPEN    702
  216. #define IDS_TOPICPRINT    703
  217. #define IDS_TOPICEDIT    704
  218. #define IDS_TOPICGSCMD    705
  219. #define IDS_TOPICSOUND    706
  220. #define IDS_TOPICMEDIA  707
  221. #define IDS_TOPICPSTOEPS 708
  222.  
  223. /* ps_to_eps */
  224. #define IDS_BBPROMPT    750
  225. #define IDS_BBPROMPT1    751
  226. #define IDS_BBPROMPT2    752
  227. #define IDS_BBPROMPT3    753
  228. #define IDS_EPSONEPAGE    754
  229. #define IDS_EPSQPAGES    755
  230. #define IDS_EPSNOBBOX    756
  231. #define IDS_EPSREAD     757
  232.  
  233. /* now the stuff that the resource compiler shouldn't see */
  234. #ifndef RC_INVOKED
  235. /* messages used between gsview and gswin */
  236. #define WM_GSVIEW WM_USER+0
  237. /* from gswin to gsview */
  238. #define HWND_TEXT    0
  239. #define HWND_IMGCHILD    1
  240. #define GSWIN_CLOSE    2
  241. #define SYNC_OUTPUT    3
  242. #define OUTPUT_PAGE    4
  243. #define SCROLL_POSITION 5
  244. #define PIPE_REQUEST    6
  245. /* from gsview to gswin image window */
  246. #define NEXT_PAGE    10
  247. #define COPY_CLIPBOARD    11
  248. /* from gsview to gswin text window */
  249. #define PIPE_DATA    12
  250.  
  251. #define MAXSTR 80
  252. #define PROFILE_SIZE 2048
  253. #define DEFAULT_GSCOMMAND "gswin"
  254. #define DEFAULT_RESOLUTION 96.0
  255. #define INIFILE "gsview.ini"
  256. #define INISECTION "Options"
  257. #define DEVSECTION "Devices"
  258.  
  259. extern char szAppName[MAXSTR];        /* application name - for title bar */
  260. extern const char szClassName[];    /* window class */
  261. extern const char szScratch[];        /* temporary filename prefix */
  262.  
  263. /* initialised in init.c */
  264. extern BOOL is_win31;            /* To allow selective use of win 3.1 features */
  265. extern char szHelpName[MAXSTR];        /* buffer for building help filename */
  266. extern char szHelpTopic[48];        /* topic for OFN_SHOWHELP */
  267. extern UINT help_message;        /* message sent by OFN_SHOWHELP */
  268. extern HMENU hmenu;            /* main menu */
  269. extern HACCEL haccel;            /* menu accelerators */
  270. extern HCURSOR hcWait;
  271. extern POINT img_offset;        /* offset to gswin child window */
  272. extern POINT info_file;            /* position of file information */
  273. extern POINT info_page;            /* position of page information */
  274. extern RECT  info_rect;            /* position and size of brief info area */
  275. extern RECT  info_coord;        /* position and size of coordinate information */
  276. extern RECT  button_rect;        /* position and size of button area */
  277.  
  278. extern HINSTANCE phInstance;        /* instance of gsview */
  279. extern HINSTANCE gswin_hinst;        /* instance of gswin */
  280. extern HWND hwndimg;            /* gsview main window */
  281. extern HWND hDlgModeless;        /* any modeless dialog box */
  282. extern HWND hwndtext;            /* gswin text window */
  283. extern HWND hwndimgchild;        /* gswin image child window */
  284. extern int bitmap_scrollx;        /* offset from bitmap to origin of child window */
  285. extern int bitmap_scrolly;
  286. extern int bitmap_width;        /* size of gswin bitmap in pixels */
  287. extern int bitmap_height;
  288.  
  289. extern struct document *doc;        /* DSC structure.  NULL if not DSC */
  290. extern int pagenum;            /* current page number */
  291. extern char dfname[MAXSTR];        /* name of selected document file */
  292. extern FILE *dfile;            /* selected file */
  293. extern FILE *cfile;            /* command file */
  294. extern char efname[MAXSTR];        /* name of temp file extracted from DOS EPS file */
  295. extern char pcfname[MAXSTR];        /* name of temp command file for printing */
  296. extern char pfname[MAXSTR];        /* name of temp file for printing options */
  297. extern BOOL is_ctrld;            /* TRUE if DSC except for ctrl+D at start of file */
  298. extern int preview;            /* preview type IDS_EPSF, IDS_EPSI, etc. */
  299. extern BOOL page_ready;            /* true when gswin has sent an OUTPUT_PAGE and is waiting for NEXT_PAGE */
  300. extern BOOL page_extra;            /* extra pages to display */
  301. extern BOOL at_prompt;            /* true if at prompt */
  302. extern BOOL saved;            /* true if interpreter state currently saved in /gssave */
  303. extern int bitmap_scrollx;        /* offset from bitmap to origin of child window */
  304. extern int bitmap_scrolly;
  305. extern OPENFILENAME ofn;
  306. extern char szOFilename[MAXSTR];    /* filename for OFN */
  307. #define DEFAULT_TIMEOUT 300        /* 300 seconds = 5 minutes per page */
  308. #define CLOSE_TIMEOUT    20
  309. extern BOOL bTimeout;            /* true if timeout occured */
  310. extern WNDPROC lpfnButtonWndProc;    /* default button WndProc */
  311. extern HINSTANCE hlib_mmsystem;        /* DLL containing sndPlaySound function */
  312. typedef BOOL (WINAPI *FPSPS)(LPCSTR, UINT);
  313. extern FPSPS lpfnSndPlaySound;        /* pointer to sndPlaySound function if loaded */
  314. extern BOOL epsf_clipped;        /* clipping this page? */
  315. #define BEEP "beep"            /* profile entry for a speaker beep */
  316. extern BOOL debug;            /* /D command line option used */
  317. struct page_list_s {
  318.     int current;    /* index of current selection */
  319.     BOOL multiple;    /* true if multiple selection allowed */
  320.     BOOL *select;    /* array of selection flags */
  321. };
  322. extern struct page_list_s page_list;
  323.  
  324. /* these can be saved in the INI file */
  325. extern char szGSwin[128];
  326. extern POINT img_origin;
  327. extern POINT img_size;
  328. extern BOOL quick;
  329. extern BOOL settings;
  330. extern BOOL button_show;
  331. extern BOOL safer;
  332. extern int media;
  333. extern char medianame[32];
  334. extern int user_width, user_height;
  335. extern BOOL epsf_clip;
  336. extern BOOL epsf_warn;
  337. extern BOOL redisplay;
  338. extern int orientation;
  339. extern BOOL swap_landscape;
  340. extern float xdpi, ydpi;
  341. extern UINT timeout;
  342. extern BOOL save_dir;
  343. extern char device_name[32];
  344. extern char device_resolution[32];
  345. #define SOUND_PAGE 0
  346. #define SOUND_NOPAGE 1
  347. #define SOUND_NONUMBER 2
  348. #define SOUND_NOTOPEN 3
  349. #define SOUND_ERROR 4
  350. #define SOUND_TIMEOUT 5
  351. #define SOUND_START 6
  352. #define SOUND_EXIT 7
  353. #define NUMSOUND 8
  354. struct sound_s {
  355.     char *entry;        /* profile entry */
  356.     int title;        /* Resource string */
  357.     char file[MAXSTR];    /* empty, "beep", or .WAV sound to play */
  358. };
  359. extern struct sound_s sound[NUMSOUND];
  360.  
  361. /* in gsview.c */
  362. BOOL get_cursorpos(int *x, int *y);
  363. void info_wait(BOOL);
  364. void play_sound(int);
  365. BOOL set_timer(UINT);
  366. void clear_timer(void);
  367. void gserror(UINT, char *, UINT, int);
  368. void pserror(char *);
  369. LRESULT CALLBACK _export MenuButtonProc(HWND, UINT, WPARAM, LPARAM);
  370. LRESULT CALLBACK _export WndImgProc(HWND, UINT, WPARAM, LPARAM);
  371.  
  372. /* in init.c */
  373. void gsview_init0(LPSTR);
  374. void gsview_init1(LPSTR);
  375. void gsview_create(void);
  376. void show_buttons(void);
  377. void read_profile(void);
  378. void write_profile(void);
  379.  
  380. /* in display.c */
  381. int get_papersizes_index(void);
  382. void gswin_size(void);
  383. void gswin_resize(void);
  384. void gsview_orientation(int);
  385. void gsview_media(int);
  386. int gswin_open(void);
  387. int gswin_close(void);
  388. void next_page(void);
  389. void do_message(void);
  390. void gsview_endfile(void);
  391. void gsview_openfile(char *);
  392. void gsview_select(void);
  393. void gsview_selectfile(char *);
  394. void gsview_display(void);
  395. void gsview_displayfile(char *);
  396. void fix_orientation(FILE *f);
  397. FILE * gp_open_scratch_file(const char *prefix, char *fname, const char *mode);
  398. BOOL dfreopen(void);
  399. void dfclose(void);
  400. BOOL dsc_scan(char *fname);
  401. void dsc_getpages(FILE *f, int first, int last);
  402. void dsc_header(FILE *f);
  403. void dsc_dopage(void);
  404. void dsc_skip(int);
  405. int map_page(int page);
  406.  
  407. /* in dialog.c */
  408. #define OPEN FALSE
  409. #define SAVE TRUE
  410. BOOL getfilename(LPSTR, BOOL, UINT, UINT, UINT);
  411. BOOL get_string(char *, char *);
  412. BOOL CALLBACK _export InputDlgProc(HWND, UINT, WPARAM, LPARAM);
  413. BOOL CALLBACK _export AboutDlgProc(HWND, UINT, WPARAM, LPARAM);
  414. BOOL CALLBACK _export SoundDlgProc(HWND, UINT, WPARAM, LPARAM);
  415. BOOL CALLBACK _export InfoDlgProc(HWND, UINT, WPARAM, LPARAM);
  416. BOOL get_page(int *, BOOL);
  417. BOOL CALLBACK _export PageDlgProc(HWND, UINT, WPARAM, LPARAM);
  418. BOOL gsview_usersize(void);
  419.  
  420. /* in pipe.c */
  421. void pipeinit(void);    /* prepare pipe for opening */
  422. FILE *pipeopen(void);    /* open pipe for first time */
  423. void pipeclose(void);    /* finished with pipe, close & delete temp files */
  424. void pipereset(void);    /* pipe is empty, do cleanup */
  425. void piperequest(void);    /* request from gswin for pipe data */
  426. void pipeflush(void);    /* start sending data through pipe */
  427. BOOL is_pipe_done(void);    /* true if pipe has just been reset */
  428.  
  429. /* in print.c */
  430. BOOL CALLBACK _export DeviceDlgProc(HWND, UINT, WPARAM, LPARAM);
  431. BOOL CALLBACK _export CancelDlgProc(HWND, UINT, WPARAM, LPARAM);
  432. BOOL CALLBACK _export SpoolDlgProc(HWND, UINT, WPARAM, LPARAM);
  433. void gsview_spool(char *, char *);
  434. void pscopydoc(FILE *fp);
  435. char *get_devices(void);
  436. void print_cleanup(void);
  437. void gsview_print(BOOL);
  438. void gsview_extract(void);
  439.  
  440. /* clip.c */
  441. LONG dib_bytewidth(LPBITMAPINFOHEADER);
  442. UINT dib_pal_colors(LPBITMAPINFOHEADER);
  443. void clip_to_file(void);
  444. void clip_convert(void);
  445. void clip_add_palette(void);
  446. void clip_add_ddb(void);
  447. void clip_add_dib(void);
  448. void extract_eps(void);
  449. void extract_doseps(WORD);
  450. void make_eps_metafile(void);
  451. void make_eps_tiff(WORD);
  452. void make_eps_interchange(void);
  453. void ps_to_eps(void);
  454.  
  455. #ifdef WIN32
  456. /* Windows NT has never been tried, but these macros fix up the */
  457.  * known differences from Windows 3.1 */
  458. /* imitation pipes will need to be rewritten to use real pipes */
  459. #define MoveTo(hdc,x,y) MoveToEx((hdc),(x),(y),(LPPOINT)NULL)
  460. #define SetClassCursor(hwnd, hcursor) SetClassLong((hwnd), GCL_HCURSOR, (LONG)(hcursor))
  461. #define GetClassCursor(hwnd) ((HCURSOR)GetClassLong((hwnd), GCL_HCURSOR))
  462. #define GetNotification(wParam,lParam) (HIWORD(wParam))
  463. #define SendDlgNotification(hwnd, id, notice) \
  464.     SendMessage((hwnd), WM_COMMAND, MAKELONG((id),(notice)), GetDlgItem((hwnd),(id)))
  465. #else
  466. #define SetClassCursor(hwnd, hcursor) SetClassWord(hwnd, GCW_HCURSOR, (WORD)(hcursor))
  467. #define GetClassCursor(hwnd) ((HCURSOR)GetClassWord(hwnd, GCW_HCURSOR))
  468. #define GetNotification(wParam,lParam) (HIWORD(lParam))
  469. #define SendDlgNotification(hwnd, id, notice) \
  470.     SendMessage((hwnd), WM_COMMAND, id, MAKELPARAM(GetDlgItem((hwnd),(id)),(notice)))
  471. #endif
  472. #endif /* !RC_INVOKED */
  473.